1. Field of the Invention
The present invention relates generally to the field of digital processing architecture. More specifically, the present invention relates to the area of data mixed scalar and vector operations.
2. Description of the Related Art
In typical digital processing systems, processors are designed to be able to operate various data structures to satisfy various requirements, such as speech recognition, imaging processing, and sound emulation. Traditionally, a general data structure is designed to handle general values while a special data structure is often dedicated to handle special cases. For example, a vector data structure is typically a special data structure for handling vectors. Also, a scalar data structure is normally used as a data structure. Typically a scalar value is used for representing a quantitative value which has a single numerical component while a vector value includes multiple numerical components.
A scalar value, such as an area, length, mass, and temperature, is completely described when the magnitude of the quantity is identified. On the other hand, a vector value is not completely described until all related values, such as magnitude and direction, are specified. For example, a vector may describe an automobile""s speed as well as its direction. Another example is that a vector may describe a speed, altitude, and direction of an airplane. Traditionally, a typical vector notation is
u=(u1, u2, . . . un)
v=(v1, v2, . . . vn)
where u1 and v1 are two vector values. The sum u+v is defined by
u+v=[u1+v1, u2+v2, . . . un+vn)
Since a vector contains more than one value or element, a typical vector data structure, which stores more than one value, can improve system performance in the area of data access and data computations. For example, a vector register may store (u1, u2) or three values (u1, u2, u3) vector values. Since vector values are stored differently from scalar values, or number of specialized vector execution units are typically employed for handling vector operations.
Consequently, a digital processing system containing vector execution units can typically implement following operations.
A2=A1op A0
B2=B1op B0
where A and B are vector values. The digital processing system should also be capable of implementing scalar operations. Such as
S2=S1op S0
where S is a scalar value.
Although vector data and scalar data are structured differently, many computations require sharing between vector and scalar values. Accordingly, it is desirable to have a system that can implement mixed vector and scalar values in an operation.
A method and an apparatus of implementing mixed scalar and vector values in a digital processing system is disclosed. In one embodiment, a digital processing system, which contains a processing unit and memories, is capable of identifying a first data in a first scalar register and a second data in a vector register. Upon fetching the first data as a first operand and the second data as a second operand, the processing unit performs an operation between the first and second operands in response to an operator. Upon completion of the operation, the result is subsequently stored in a second scalar register.
In another embodiment, a digital processing device includes a microprocessor and a memory where the memory contains mixed scalar/vector instructions. Each mixed scalar/vector instruction indicates whether the operands are scalar or/and vector values and how to operate mixed scalar/vector operations.